package com.itheima.xiancheng.demo1;

public class Cooker extends Thread {
    @Override
    public void run() {
        while (true) {
            synchronized (Desk.obj) {
                if (Desk.count == 0) {
                    break;
                }else{
                    if (Desk.flag){
                        try {
                            Desk.obj.wait();
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }else {
                        System.out.println("厨师生产");
                        Desk.flag=true;
                        Desk.obj.notify();
                    }
                }
            }
        }

    }
}
